-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataStore and GraphQL API Cognito Public Request #1736
Comments
Hi @MarlonJD - please provide your GraphQL schema, and the error being shown in the console when you get a chance. Thanks, and sorry you are experiencing this issue. |
GraphQL Schema:
I'm trying to access Universities without cognito user as public. like this:
and it's giving me this error:
|
Hi @MarlonJD - can you confirm you are passing |
Yes here's my amplify init code:
And yes I tried apiName and it's running when I'm trying Amplify.API.* but I cannot run with DataStore anymore if I add multi auth to amplifyconfiguration.dart, It gaves me to give me apiName but there's no configuration for DataStore.* like apiName parameter. |
We've identified the cause for this one due to a lack of support for this kind of use case (multi-auth for API + multi-auth for DataStore in the same App). Can you paste |
Thanks for the reply, but i didn't understand that where can I found modelSchemaDefinition.authRules ? |
@MarlonJD - This would be found in the generated files for some of the models (Company, Teacher, Student) |
Okay but which file? Should i add all generated file to here? |
@MarlonJD take a look at
Look into this file, you should be able to find |
There is authRules in Department but not in DepartmentStudent and DepartmentTeacher In department
on Teacher:
DepartmentStudents:
DepartmentTeachers:
Department:
Teacher.dart:
|
Hi @MarlonJD I'm a bit new to this issue and seems like there's been a long conversation on this. This is what I understand the issue to be: You cannot retrieve certain object types because you receive a console error saying you don't have proper authorization. You were told to use multi auth setup but then got a different issue because the use of multi-auth for API + multi-auth for DataStore in the same App is still unsupported1: It seems you provided the information @HuiSF requested but also pasted all of your codegen models. While the extra information could be helpful it's a bit much and makes scrolling through this issue a bit harder - could you shorten your reply above to just include the authRules? If we need that info we can ask for it later. |
Hey thanks for you detailed answer but I already cut my answer at the begining of the my answer.
I just wrote all DepartmentStudent and DepartmentTeacher for debugging, because there is no authRules in there.
I also used only API (GraphQL) without DataStore no luck. Cognito + API not works, I cannot access any public datas without login. I also used any method like IAM + API, Cognito + IAM etc. Can anybody access anything like these configration? I think there is an issue about the auto generated models. |
Hi sorry for lacking activities on this issue. I've tested DataStore multi-auth based on a few similar issues in the repo, and found that both amplify-swift (v1) and amplify-android (v1+v2) have issues around multi-auth. This causes common issue that models with public permission cannot work correctly without signing in a user. I'm going to close this issue as a duplicate, so we can track the progress in #1693. |
Description
Hello. I created graphql based api with amplify.
Cognito is the default auth for api.
I updated auth with unauthorized user to user.
My models have public accesses like public for read. When i'm trying to access anything from related model without user signed. It gives me error that i didnt sign in with cognito.
I tried public with provider: iam not works.
I tried public with provider: apiKey not works.
It always gave me to there is no token for signed cognito user.
When i add multiple api configuration. Datastore starting to give me error for giving apiName for this, but datastore doesnt have apiName parameter I think. And Amplify.API.* not run without huge configrations.
I think it should work without any configuration more like this. How can i achieve this ?
I cannot access anything without user signed in.
I need help.
Categories
Steps to Reproduce
Cognito Based GraphQL API.
I cannot access any model that public read access (not signed user)
Screenshots
No response
Platforms
Android Device/Emulator API Level
API 21
Environment
Dependencies
Device
iPod 7
OS
iOS 15.5
CLI Version
7.6.21
Additional Context
No response
The text was updated successfully, but these errors were encountered: