Closed eytanschulman closed 4 years ago
@eytanschulman As far as I remember, we didn't come across this kind of issue in our development. Believing that your routes are working fine, I would say just to double check client_id
, client_secret
, code
or grant_type
is correct or not, because may be these params are the cause of your issue.
@eytanschulman As far as I remember, we didn't come across this kind of issue in our development. Believing that your routes are working fine, I would say just to double check
client_id
,client_secret
,code
orgrant_type
is correct or not, because may be these params are the cause of your issue.
Thanks @aamishbaloch , I'll check them again. Did you see what I wrote above about how I am retrieving the client_secret
?
@eytanschulman Yes, I have seen that, looking fine to me, but we cannot rule out anything. Sometime apple don't give us the exact error responses, but I'm sure issue lies in the params I mentioned above. Something is invalid, that you have to check.
@eytanschulman Yes, I have seen that, looking fine to me, but we cannot rule out anything. Sometime apple don't give us the exact error responses, but I'm sure issue lies in the params I mentioned above. Something is invalid, that you have to check.
What do you mean exactly by code
? I just checked everything else, they all seem to be in check to me.. By the way, when debugging this in Python I do not even enter the functions within AppleOAuth2
before I get the response.
The Django logs a 302 Redirect
, and then within the app I get back the 403
from Apple.
Code is the access_token
from app.
Have you added AppleOAuth2
in AUTHENTICATION_BACKENDS?
I just checked the access_token
from the app, which I am sending as a parameter called authorizationCode
. Just tried changing from authorizationCode
to access_token
, still didn't work 😄
Question: When you send the access_token
from the app to your backend, are you sending it in the body as a JSON
dict, like this?
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let jsonData = try! JSONSerialization.data(withJSONObject: ["authorizationCode": code], options: [])
let task = session.uploadTask(with: request, from: jsonData) { data, response, error in
if let data = data, let dataString = String(data: data, encoding: .utf8) {
handler(dataString, error)
}
}
Yes, I have the proper path to the AppleOAuth2
class in my AUTHENTICATION_BACKENDS
. When debugging, I enter the do_auth
func in social_django/views
, and the backend
variable is an instance of AppleOAuth2
.
I have no idea about that but I guess you can find that here.
Thanks, the function which does it is empty in the example 😄
func exchangeCode(_ code: String, handler: (String?, Error?) -> Void) {
// Call your backend to exchange an API token with the code.
}
ping @lukaswuerzburger
@eytanschulman sorry, I totally missed the ping. In our app we send the access_token
as a url parameter, not in the payload. Keep us posted if it helped! Sorry again for the delay.
I'll close this ticket due to inactivity
Hey, thanks for the tutorial, it's super instructive! I was wondering if you had an idea, or maybe came across this issue in development. In response to executing a
POST
request to/login/apple
, I am receiving the following:Here is my backend
AppleOAuth2
implementation:One difference may be that I am loading
SOCIAL_AUTH_APPLE_PRIVATE_KEY
like this:On the iOS client side, this is the
ViewController
:Would be happy to give additional details, thanks again!