Hari
10/16/2025, 9:17 AMRahul Rijhwani
10/16/2025, 2:26 PMValidateSessionWithToken, here are key validation points to check:
Verify aud claim validation: The session token should include the correct audience claim. Use the proper validation method with your Project ID:
// Validate session with aud claim
authorized, userToken, err := descopeClient.Auth.ValidateSessionWithToken(ctx, sessionToken, "__ProjectID__")
if (err != nil){
fmt.Println("Could not validate user session: ", err)
} else {
fmt.Println("Successfully validated user session: ", userToken)
}
Check token extraction: Ensure the session token is properly extracted from the Authorization header. The token format and extraction method should be identical on both laptops.
Verify client configuration: Confirm both laptops use the same Descope client setup:
descopeClient, err := client.NewWithConfig(&client.Config{ProjectID:"__ProjectID__"})
if err != nil {
log.Println("failed to initialize: " + err.Error())
}
Common causes for G030002 "Invalid token" error:
The error suggests the token itself is malformed or doesn't match the expected validation parameters rather than being expired.
Reference docs:
https://docs.descope.com/getting-started/go
https://docs.descope.com/authorization/session-management/session-validation/backendHari
10/21/2025, 9:32 AMHari
10/22/2025, 1:07 PM