W
Wasp-lang•5d ago
Sven

Ios abb subscription and login auth

How would I make a user authorized to use an ios app if they have a certain subscription? Also how would I do this with login.
9 Replies
kapa.ai
kapa.ai•5d ago
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, Wasp currently does not have first-class support for mobile clients, including iOS apps. This means that while it's possible to have a mobile app, it will require additional work and may not be as straightforward as it is for web clients. For user authentication, Wasp provides a standard login and signup flow that allows users to sign up and log in with their username and password. The signup flow validates the username and password and then creates a new user entity in the database. You can customize this flow by creating your own UI and using the signup and login actions provided by Wasp. Here is an example of how you can use these actions:
import { signup, login } from 'wasp/client/auth'

import { useState } from 'react'
import { useHistory } from 'react-router-dom'
import { Link } from 'react-router-dom'

export function Signup() {
const [username, setUsername] = useState('')
const [password, setPassword] = useState('')
const [error, setError] = useState<Error | null>(null)
const history = useHistory()

async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
try {
await signup({
username,
password,
})
await login(username, password)
history.push("/")
} catch (error: unknown) {
setError(error as Error)
}
}

return (
<form onSubmit={handleSubmit}>
{/* ... */}
</form>
);
}
import { signup, login } from 'wasp/client/auth'

import { useState } from 'react'
import { useHistory } from 'react-router-dom'
import { Link } from 'react-router-dom'

export function Signup() {
const [username, setUsername] = useState('')
const [password, setPassword] = useState('')
const [error, setError] = useState<Error | null>(null)
const history = useHistory()

async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
try {
await signup({
username,
password,
})
await login(username, password)
history.push("/")
} catch (error: unknown) {
setError(error as Error)
}
}

return (
<form onSubmit={handleSubmit}>
{/* ... */}
</form>
);
}
(Source: Wasp Docs (https://wasp-lang.dev/docs/auth/username-and-pass#signup)) As for authorizing a user based on their subscription status, it seems that there was a discussion in the Wasp community about how to handle subscription statuses. However, the final decision or implementation is not clear from the provided sources. You might need to implement your own logic to check the user's subscription status and grant access accordingly. Please note that this information is based on the provided knowledge sources and may not cover all aspects of your question. For more detailed information, you might want to check the official Wasp documentation or reach out to the Wasp community. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Sven
Sven•5d ago
Wasp devs any suggestions?
Adam
Adam•4d ago
https://github.com/wasp-lang/wasp/issues/1973 https://github.com/wasp-lang/wasp/issues/1088 Auth will happen in q3, maybe we can start either with expo or Infinite Red then.
miho
miho•4d ago
Yep, we are still building the support for using Wasp auth in external apps 🙂 Thank you for linking these issues @Adam
Adam
Adam•4d ago
Happy to answer a few of you all's messages wasp has saved me so much and has really propelled my desktop app - thank you! Hopefully can make it a mobile app soon too
MEE6
MEE6•4d ago
Wohooo @Adam, you just became a Waspeteer level 2!
Filip
Filip•3d ago
Very happy to hear that, Adam! 🥰
Sven
Sven•3d ago
Would you guys recommend deploying to also see how it works when operating?
Filip
Filip•3d ago
I would, yes
Want results from more Discord servers?
Add your server