Hello, i get the following error message:
Gets the code:
What could be the reason for this? Is the code incorrectly coded?
This is what i get from the server:
Thanks for any hint
B4X:
ResponseError. Reason: , Response: {"message":"Invalid or expired OAuth authorization"}
B4X:
Private Sub GetTokenFromAuthorizationCode (Code As String)
Log("Getting access token from authorization code...")
Dim j As HttpJob
j.Initialize("", Me)
Dim postString As String = $"code=${Code}&client_id=${"xx"}&grant_type=authorization_code&redirect_uri=${GetRedirectUri}"$
postString = postString & "&client_secret=" & "xx"
j.PostString("https://api.supabase.com/v1/oauth/token", postString)
j.GetRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded")
j.GetRequest.SetHeader("apikey","xxx")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
TokenInformationFromResponse(j.GetString)
Else
ResetToken
RaiseEvent(False)
End If
j.Release
End Sub
B4X:
Private Sub ParseBrowserUrl(Response As String)
Log(Response)
Dim m As Matcher = Regex.Matcher("code=([^&\s]+)", Response)
If m.Find Then
Dim code As String = m.Group(1)
Log(code)
GetTokenFromAuthorizationCode(code)
Else
Log("Error parsing server response: " & Response)
ResetToken
RaiseEvent(False)
End If
End Sub
What could be the reason for this? Is the code incorrectly coded?
This is what i get from the server:
B4X:
GET /?state=xxx&code=4%2F0Adeu5BXVu-MuYoH-8TupWpIo2ddii0CcIqPPbR7R9QPTvoY64bKIaP8vna7Lkq6YQ_SrOw&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid&authuser=0&prompt=consent HTTP/1.1
Thanks for any hint